﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class admin_adminLogin : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    #region 管理员登录
    /// <summary>
    /// 管理员登录
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnLogin_Click(object sender, ImageClickEventArgs e)
    {
        BLL.Users blluser=new BLL.Users();
        MODEL.Users model=new MODEL.Users();
        string name = txtLoginId.Text.Trim();
        string pwd =txtLoginPwd.Text.Trim();
         //登录(用户名，密码正确则登录成功)
        if (blluser.ExistAdmin(name, pwd))
        {
            model = blluser.getModel(name);
            if (model != null)
            {
                //把model实体对象保存到session中
                Session["currentAdmin"] = model;
                Response.Redirect("ListAllUsers.aspx");
            }
        }
        else
        {
            MessageBox.Show(this, "用户名或密码有错");
        }
    } 
    #endregion

    #region 重置
    /// <summary>
    /// 重置
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void imgbtnReset_Click(object sender, ImageClickEventArgs e)
    {
        txtLoginId.Text = "";
        txtLoginPwd.Text = "";
    } 
    #endregion
}